package main

import "strings"

func convert(s string, numRows int) string {
	if numRows == 1 {
		return s
	}
	list := make([]string, numRows)
	direct, p := 1, 0
	for _, v := range s {
		if p == 0 {
			direct = 1
		} else if p == numRows-1 {
			direct = -1
		}
		list[p] += string(v)
		p += direct
	}
	return strings.Join(list, "")
}
